<?php

namespace app\admin\controller;

use library\Controller;
use think\Db;

/**
 * 投资赠送规则
 * Class Item
 * @package app\admin\controller
 */
class InvestGive extends Controller{
    /**
     * 绑定数据表
     * @var string
     */
    protected $table = 'LcInvestGive';

    /**
     * 投资赠送规则
     * @auth true
     * @menu true
     * @throws \think\Exception
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     * @throws \think\exception\PDOException
     */
    public function index(){
        $this->title = '投资赠送规则';
        $query = $this->_query($this->table);
        $query = $query->order('invest_total asc')->page();
    }

    /**
     * 数据列表处理
     * @param array $data
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    protected function _index_page_filter(&$data){
    }

    public function add()
    {
        $this->title = '添加项目分类';
        $this->_form($this->table, 'form');
    }

    public function edit()
    {
        $this->title = '编辑项目分类';
        $this->_form($this->table, 'form');
    }

    public function remove()
    {
        $this->_delete($this->table);
    }

    /**
     * 表单数据处理
     * @param array $vo
     * @throws \ReflectionException
     */
    protected function _form_filter(&$vo){
        if ($this->request->isGet()) {
            $vo['give_type'] = isset($vo['give_type'])?$vo['give_type']:1;
        }
    }
}
